package xyz.hujf.otherbase.lock;

import java.util.concurrent.locks.ReentrantLock;

/**
 * @author Hujf
 * @title: Temp
 * @date 2021-04-2410:52
 * @description: TODO
 */
public class Temp {
    ReentrantLock lock = new ReentrantLock(true);
    private int count =1;
    public static void main(String[] args) {
        Temp temp = new Temp();

        new Thread(()->{
            String tName = Thread.currentThread().getName();

        });
    }


    public void modify(String name){
        System.out.println("通知管理员"+name+"准备打水");
        lock.lock();
        System.out.println(name+"打水");
        count++;
        System.out.println("线程"+name+"打第"+count+"桶水");
        lock.lock();

    }
}
